package oo;

class Fish{
    int weight;
}
class Lake{
    Fish fish;
    void setFish(Fish s){
        fish = s;}
    void eat(int n){
        fish.weight =fish .weight + n;
        Fish niqiu = new Fish ();
    }
}
class FishandLake{
    public static void main(String[] args) {
        Fish niqiu = new Fish();
        System.out.println("泥鳅的重量："+niqiu.weight);
        Lake taihu  = new Lake();
        taihu.setFish(niqiu);
        taihu.eat(15);
        System.out.println("喂食后太湖里泥鳅的重量："+taihu.fish.weight);

        Lake dongtinghu = new Lake();
        dongtinghu.setFish(niqiu);
        dongtinghu.eat(20);
        System.out.println("再次喂食后泥鳅的重量："+niqiu.weight);
        System.out.println("再次喂食后太湖里泥鳅的重量："+taihu.fish.weight);
        System.out.println("再次喂食后洞庭湖里泥鳅的重量："+dongtinghu.fish.weight);
    }

}
